package binarytree

func isSameTree(p *TreeNode, q *TreeNode) bool {

	if (p != nil && q == nil) || (p == nil && q != nil) || p.Val != q.Val {
		return false
	}
	return isSameTree(p.Right, q.Right) && isSameTree(q.Left, p.Left)
}
